package com.lyn.utils;

import android.annotation.SuppressLint;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author longyn 2023/2/1
 * @version 1.0.0
 */
public class TimeUtil {

    public static final String DEFAULT_FORMAT_YYYY_MM_DD = "yyyy-MM-dd HH:mm:ss";

    public static String get() {
        return get(DEFAULT_FORMAT_YYYY_MM_DD);
    }

    public static String get(String format) {
        return get(format,System.currentTimeMillis());
    }

    public static String get(long timeMillis){
        return get(DEFAULT_FORMAT_YYYY_MM_DD,timeMillis);
    }

    public static String get(String format, long timeMillis) {
        @SuppressLint("SimpleDateFormat")
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
        return simpleDateFormat.format(new Date(timeMillis));
    }
}
